home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / fortran / toolpack.000 / toolpack / toolpack1.2 / scriptsource / apt.s next >
Encoding:
Text File  |  1993-10-04  |  3.1 KB  |  100 lines

  1. #! /bin/csh
  2. #  apt is a csh script to convert a REAL (DOUBLE PRECISION) version of
  3. #  a Fortran program to DOUBLE PRECISION (REAL) using ISTPT.
  4. #    (via the combined tool fragment ISTQP = ISTLX/ISTYP/ISTPT/ISTPL)
  5. #
  6. #
  7. #  Invocation:
  8. #
  9. #  apt <s or d> Polish_option_file Fortran_source_file
  10. #
  11. #  If the first argument is "s" ("d") then the Fortran in Fortran_source_file
  12. #  will be transformed to a REAL (DOUBLE PRECISION) version.
  13. #
  14. #  Polish_option_file is the name of a file containing Polish options used in
  15. #  reconstructing the transformed Fortran.  If Polish_option_file is "-"
  16. #  then default Polish options will be used.
  17. #
  18. #  Check command line validity.
  19. if ( $#argv < 3 || ( $1 != "s" && $1 != "d" ) ) then
  20. TOOLPACKPATH/toolpack1.2/util/echoerr \
  21. Invocation:
  22. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  23. TOOLPACKPATH/toolpack1.2/util/echoerr \
  24. "apt <s or d> Polish_option_file Fortran_source_file"
  25. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  26. TOOLPACKPATH/toolpack1.2/util/echoerr \
  27. The first argument is s or d indicating that the transformed
  28. TOOLPACKPATH/toolpack1.2/util/echoerr \
  29. program is to be single or double precision, respectively.
  30. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  31. TOOLPACKPATH/toolpack1.2/util/echoerr \
  32. 'Polish_option_file is created by using script "polx".'
  33. TOOLPACKPATH/toolpack1.2/util/echoerr \
  34. 'Note: "-" as Polish_option_file gives default options.'
  35. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  36. TOOLPACKPATH/toolpack1.2/util/echoerr \
  37. Transformed code is sent to standard output and may be redirected to a file.
  38. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  39.    exit
  40. endif
  41. #  "-" as Polish_option_file gives default options.
  42. if ( $2 != - ) then
  43. #  Check that Polish_option_file exists.
  44.    if ( -e $2 == 0 ) then
  45. TOOLPACKPATH/toolpack1.2/util/echoerr \
  46. "'$2' does not exist. '-' as the second argument gives default Polish options."
  47.       exit
  48.    endif
  49. endif
  50. #  Check that Fortran_source_file exists.
  51. if ( -e $3 == 0 ) then
  52. TOOLPACKPATH/toolpack1.2/util/echoerr \
  53. "'$3' does not exist."
  54.    exit
  55. endif
  56. #
  57. #  Create PFS.  If PFS already exists, exit with an advisory message.
  58. #
  59. if ( -e _.TOOLPACK == 0 ) then
  60.    mkdir _.TOOLPACK
  61. else
  62. TOOLPACKPATH/toolpack1.2/util/echoerr \
  63. Toolpack-created directory '"_.TOOLPACK"' exists. \
  64. Remove with script '"discard"'.
  65.    exit
  66. endif
  67. #  Make a tab-free copy of the Fortran source and use it as source.
  68. set src = qp.src$$
  69. expand $3 > _.TOOLPACK/$src
  70. #  Create the inter-process file IST.CMD and append parameters for ISTQP.
  71. if ( $1 == "s") then
  72.    set ptoptfile = 'single'
  73. else
  74.    set ptoptfile = 'double'
  75. endif
  76. if ( $2 == - ) then
  77. TOOLPACKPATH/toolpack1.2/util/mkipf \
  78. $src \#1 "$ptoptfile" -
  79. else
  80. TOOLPACKPATH/toolpack1.2/util/mkipf \
  81. $src \#1 "$ptoptfile" \#$2
  82. endif
  83. #
  84. #  Invoke ISTQP.
  85. #
  86. TOOLPACKPATH/toolpack1.2/exec/istqp.u
  87. #
  88. #  If tool terminated with errors, advise user to obtain listing.
  89. if ( `cat _.TOOLPACK/_.info` == -1 ) then
  90. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  91. TOOLPACKPATH/toolpack1.2/util/echoerr \
  92. 'Errors detected.  Invoke script "getlst" to obtain a listing showing'
  93. TOOLPACKPATH/toolpack1.2/util/echoerr \
  94. statement and token numbers.
  95. TOOLPACKPATH/toolpack1.2/util/echoerr ""
  96. endif
  97. #
  98. /bin/rm -r _.TOOLPACK
  99. #
  100.